package gui;

import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.JPanel;

public class Choix extends JFrame{
	/**
	 * La classe qui construit une petite fenetre pour que les clients peuvent 
	 * choisir le type de protolole 
	 */
	
	private static final long serialVersionUID = 1L;
	private DialogueChoix newContentPane;
	public Choix()
	{
		
         this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
         newContentPane = new DialogueChoix(this);
         newContentPane.setOpaque(true); 
         this.setContentPane(newContentPane);
         this.pack();
         this.setVisible(true);
	}
	
	public int getchiox()
	{
		return this.newContentPane.getChoix();
	}

	class DialogueChoix extends JPanel
	{
		/**
		 * 
		 */
		private static final long serialVersionUID = 1L;
		private JFrame jfr;
		private int choix;
		
		public DialogueChoix(JFrame jfr)
		{
			this.jfr=jfr;
			init();
		}
		
		public void init()
		{
			Object[] options = {"Abcast","Cbcast","Fbcast"};
			choix = JOptionPane.showOptionDialog(jfr,
					"Choisir le protocole utiliser?",
					"Protocole",
					JOptionPane.YES_NO_OPTION,
					JOptionPane.QUESTION_MESSAGE,
					null,     //do not use a custom Icon
					options,  //the titles of buttons
					options[0]); //default button title
		}
		
		public int getChoix() {
			return choix;
		}
	}

}
